package com.example.yuejian21.nongfusanquan.yuejian21.model;

import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Activitybean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.ClubActivitybean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Orderactivitybean;
import com.example.yuejian21.nongfusanquan.yuejian21.service.ActivityService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Nongfusanquan on 2017-10-11.
 */

public class Activitymodel {
    private Retrofit retrofit;
    public Activitymodel() {
        retrofit = new Retrofit.Builder()
                .baseUrl("http://10.0.2.2/yuejian14/index.php/API/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
        public Call<List<Activitybean>> getactivitylist(){
            ActivityService activityService = retrofit.create(ActivityService.class);
            return activityService.getAllactivities();
        }

    public Call<List<ClubActivitybean>> getClubActivity(){
        ActivityService activityService = retrofit.create(ActivityService.class);
        return activityService.getClubActivity();
    }

    //报名活动
    public Call<Orderactivitybean> addactivityn(int u_id, int a_id){
        ActivityService activityService = retrofit.create(ActivityService.class);
        return activityService.addactivityn(u_id,a_id);
    }
    //活动详情
    public Call<Activitybean> getDetail(int a_id){
        ActivityService activityService = retrofit.create(ActivityService.class);
        return activityService.getDetail(a_id);
    }
    }

